package com.fitns.user.mapper.baseConfig;

import static com.fitns.user.mapper.baseConfig.TbFacilityTypeDynamicSqlSupport.*;
import static org.mybatis.dynamic.sql.SqlBuilder.*;


import java.util.List;
import com.fitns.user.model.baseConfig.TbFacilityType;
import javax.annotation.Generated;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.SqlBuilder;
import org.mybatis.dynamic.sql.delete.DeleteDSL;
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.render.RenderingStrategy;
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
import org.mybatis.dynamic.sql.select.SelectDSL;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;

@Mapper
public interface TbFacilityTypeMapper {
    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    long count(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @DeleteProvider(type=SqlProviderAdapter.class, method="delete")
    int delete(DeleteStatementProvider deleteStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @InsertProvider(type=SqlProviderAdapter.class, method="insert")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="record.id", before=false, resultType=Long.class)
    int insert(InsertStatementProvider<TbFacilityType> insertStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @ResultMap("TbFacilityTypeResult")
    TbFacilityType selectOne(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="TbFacilityTypeResult", value = {
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="facility_type", property="facilityType", jdbcType=JdbcType.VARCHAR),
        @Result(column="icon", property="icon", jdbcType=JdbcType.VARCHAR),
        @Result(column="descs", property="descs", jdbcType=JdbcType.VARCHAR),
        @Result(column="input_time", property="inputTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="modify_time", property="modifyTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_id", property="createId", jdbcType=JdbcType.BIGINT),
        @Result(column="modify_id", property="modifyId", jdbcType=JdbcType.BIGINT)
    })
    List<TbFacilityType> selectMany(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @UpdateProvider(type=SqlProviderAdapter.class, method="update")
    int update(UpdateStatementProvider updateStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
        return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
                .from(tbFacilityType);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
        return DeleteDSL.deleteFromWithMapper(this::delete, tbFacilityType);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int deleteByPrimaryKey(Long id_) {
        return DeleteDSL.deleteFromWithMapper(this::delete, tbFacilityType)
                .where(id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insert(TbFacilityType record) {
        return insert(SqlBuilder.insert(record)
                .into(tbFacilityType)
                .map(facilityType).toProperty("facilityType")
                .map(icon).toProperty("icon")
                .map(descs).toProperty("descs")
                .map(inputTime).toProperty("inputTime")
                .map(modifyTime).toProperty("modifyTime")
                .map(createId).toProperty("createId")
                .map(modifyId).toProperty("modifyId")
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insertSelective(TbFacilityType record) {
        return insert(SqlBuilder.insert(record)
                .into(tbFacilityType)
                .map(facilityType).toPropertyWhenPresent("facilityType", record::getFacilityType)
                .map(icon).toPropertyWhenPresent("icon", record::getIcon)
                .map(descs).toPropertyWhenPresent("descs", record::getDescs)
                .map(inputTime).toPropertyWhenPresent("inputTime", record::getInputTime)
                .map(modifyTime).toPropertyWhenPresent("modifyTime", record::getModifyTime)
                .map(createId).toPropertyWhenPresent("createId", record::getCreateId)
                .map(modifyId).toPropertyWhenPresent("modifyId", record::getModifyId)
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbFacilityType>>> selectByExample() {
        return SelectDSL.selectWithMapper(this::selectMany, id, facilityType, icon, descs, inputTime, modifyTime, createId, modifyId)
                .from(tbFacilityType);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbFacilityType>>> selectDistinctByExample() {
        return SelectDSL.selectDistinctWithMapper(this::selectMany, id, facilityType, icon, descs, inputTime, modifyTime, createId, modifyId)
                .from(tbFacilityType);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default TbFacilityType selectByPrimaryKey(Long id_) {
        return SelectDSL.selectWithMapper(this::selectOne, id, facilityType, icon, descs, inputTime, modifyTime, createId, modifyId)
                .from(tbFacilityType)
                .where(id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(TbFacilityType record) {
        return UpdateDSL.updateWithMapper(this::update, tbFacilityType)
                .set(facilityType).equalTo(record::getFacilityType)
                .set(icon).equalTo(record::getIcon)
                .set(descs).equalTo(record::getDescs)
                .set(inputTime).equalTo(record::getInputTime)
                .set(modifyTime).equalTo(record::getModifyTime)
                .set(createId).equalTo(record::getCreateId)
                .set(modifyId).equalTo(record::getModifyId);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(TbFacilityType record) {
        return UpdateDSL.updateWithMapper(this::update, tbFacilityType)
                .set(facilityType).equalToWhenPresent(record::getFacilityType)
                .set(icon).equalToWhenPresent(record::getIcon)
                .set(descs).equalToWhenPresent(record::getDescs)
                .set(inputTime).equalToWhenPresent(record::getInputTime)
                .set(modifyTime).equalToWhenPresent(record::getModifyTime)
                .set(createId).equalToWhenPresent(record::getCreateId)
                .set(modifyId).equalToWhenPresent(record::getModifyId);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKey(TbFacilityType record) {
        return UpdateDSL.updateWithMapper(this::update, tbFacilityType)
                .set(facilityType).equalTo(record::getFacilityType)
                .set(icon).equalTo(record::getIcon)
                .set(descs).equalTo(record::getDescs)
                .set(inputTime).equalTo(record::getInputTime)
                .set(modifyTime).equalTo(record::getModifyTime)
                .set(createId).equalTo(record::getCreateId)
                .set(modifyId).equalTo(record::getModifyId)
                .where(id, isEqualTo(record::getId))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKeySelective(TbFacilityType record) {
        return UpdateDSL.updateWithMapper(this::update, tbFacilityType)
                .set(facilityType).equalToWhenPresent(record::getFacilityType)
                .set(icon).equalToWhenPresent(record::getIcon)
                .set(descs).equalToWhenPresent(record::getDescs)
                .set(inputTime).equalToWhenPresent(record::getInputTime)
                .set(modifyTime).equalToWhenPresent(record::getModifyTime)
                .set(createId).equalToWhenPresent(record::getCreateId)
                .set(modifyId).equalToWhenPresent(record::getModifyId)
                .where(id, isEqualTo(record::getId))
                .build()
                .execute();
    }
}